package com.xyzm.demo.dmhr.controller;


import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.xyzm.demo.common.Result;
import com.xyzm.demo.dmhr.entity.City;
import com.xyzm.demo.dmhr.service.ICityService;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author yy
 * @since 2021-08-15
 */
@Controller
@ResponseBody
@RequestMapping("/dmhr/city")
public class CityController {
	@Autowired
	ICityService cityService;
	@RequestMapping("/list")
	public Result list(){
		List<City> list = cityService.list();
		return Result.ok(list);
	}
	@RequestMapping("/findByPage")
	public Result findByPage() {
		Page<City> page = new Page<City>(1,2);
		QueryWrapper<City> queryWrapper = new QueryWrapper<City>();
		IPage<City> selectByPage = cityService.selectByPage(page, queryWrapper);
		return Result.ok(selectByPage);
	}

}
